<?php include show_tpl('public_uheader.htm'); ?>

<div style="width:100%; height:20px; background:#E9ECF3;"></div>

<?php include show_tpl('public_usider.htm'); ?>

<div id="page-wrapper" class="gray-bg">

	<div class="row wrapper wrapper-content">
		<div class="row">
			<div class="col-md-12">
				<div class="panel panel-default">
					<div class="panel-heading">
						<div class="panel-title">
							<em class="fa fa-list"></em>
							申请提现
							<span style="margin-top:-20px;margin-bottom:20px;text-align:center;font-size:12px;color:#666">
								&nbsp;&nbsp;&nbsp;可提现金额：<span class="blue">¥<span id="coin"><?php echo $user['coin']; ?></span></span>&nbsp;&nbsp;&nbsp;
								<i class="fa fa-info"></i> 最低提现金额：<span class="red">¥<?php echo $conf['cash_min'];?></span>&nbsp;&nbsp;&nbsp;最高提现金额：<span class="red">¥<?php echo $conf['cash_max'];?></span>&nbsp;&nbsp;&nbsp;
								</i> 
								提现手续费：
								<?php if($conf['cash_fee_percent']>0){ ?>
								<span class="green"><?php echo $conf['cash_fee_percent']*100;?>%</span>
								<?php } ?>
								<?php if($conf['cash_fee_percent']>0 && $conf['cash_fee_fixed']){ ?> + <?php } ?>
								<?php if($conf['cash_fee_fixed']){ ?>
								<span class="green"><?php echo $conf['cash_fee_fixed'];?>元</span>
								<?php }	?>
							</span>
						</div>
					</div>
					<div class="panel-body">
						<div class="content-box">
							<?php if($bank){ ?>
							<form class="form-ajax form-horizontal" id="form" action="<?php echo url('user-cash'); ?>" method="post">
								<div class="form-group">
									<label class="col-md-2 control-label">提现银行：</label>
									<div class="col-lg-6">
										<select class="form-control" name="bank">
											<?php foreach($bank as $b){ ?>
											<option value="<?php echo $b['id'];?>">
												<?php echo $b['bank'].'&nbsp;&nbsp;'.$b['code'].'&nbsp;&nbsp;'.$b['name'];?>
											</option>
											<?php } ?>
										</select>
									</div>
								</div>
								<div class="form-group">
									<label class="col-md-2 control-label">提现金额：</label>
									<div class="col-lg-6">
										<input type="text" name="coin" class="form-control"> 
									</div>
								</div>
								<div class="form-group">
									<label class="col-md-2 control-label">提款密码：</label>
									<div class="col-lg-6">
										<input type="password" name="password_ti" class="form-control"> 
									</div>
								</div>
								<div class="form-group">
									<div class="col-md-offset-2 col-md-6">
										<button type="submit" class="btn btn-success" id="submit">
											&nbsp;<i class="fa fa-check-square-o"></i>&nbsp;
											确认提现&nbsp;
										</button>
									</div>
								</div>
							</form>
							<?php }else{ ?>
							<button class="btn btn-primary" onclick="window.location.href='<?php echo url('user-bank');?>'">请先绑定银行账号</button>
							<?php } ?>
						</div>
					</div>  
				</div>
			</div>
		</div>
	</div>
</div>

<?php include show_tpl('public_ufooter.htm'); ?>

<script>
	$('#submit').click(function(){
		var $this = $('#submit');
		$this.attr('disabled', '1');
		var postdata = $('#form').serialize();
		$.post($('#form').attr('action'), postdata, function(message){
			alert(message.message);
			if(message.code==1) window.location.reload();
			$this.attr('disabled', false);
		}, 'json');
		return false;
	});
</script>